{
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "Console.WriteLine(\"Hello World\");"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Hello World\r\n"
          ]
        }
      ],
      "execution_count": 1,
      "metadata": {
        "name": "helloWorld"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "#r \"nuget:SIPSorcery, 4.0.13-pre\"\n",
        "\n",
        "const string USERNAME = \"softphonesample\";\n",
        "const string PASSWORD = \"password\";\n",
        "const string DOMAIN = \"sipsorcery.com\";\n",
        "const int EXPIRY = 120;\n",
        "\n",
        "Console.WriteLine(\"SIPSorcery Registration Demo\");\n",
        "\n",
        "var sipTransport = new SIPTransport();\n",
        "var regUserAgent = new SIPRegistrationUserAgent(sipTransport, USERNAME, PASSWORD, DOMAIN, EXPIRY);\n",
        "\n",
        "// Event handlers for the different stages of the registration.\n",
        "regUserAgent.RegistrationFailed += (uri, err) => Console.WriteLine($\"{uri.ToString()}: {err}\");\n",
        "regUserAgent.RegistrationTemporaryFailure += (uri, msg) => Console.WriteLine($\"{uri.ToString()}: {msg}\");\n",
        "regUserAgent.RegistrationRemoved += (uri) => Console.WriteLine($\"{uri.ToString()} registration failed.\");\n",
        "regUserAgent.RegistrationSuccessful += (uri) => Console.WriteLine($\"{uri.ToString()} registration succeeded.\");\n",
        "\n",
        "// Start the thread to perform the initial registration and then periodically resend it.\n",
        "regUserAgent.Start();\n",
        "\n",
        "Console.WriteLine(\"Waiting 10s for registration to complete...\");\n",
        "await Task.Delay(10000);\n",
        "\n",
        "Console.WriteLine(\"Finished.\");"
      ],
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/html": [
              "Installing package SIPSorcery, version 4.0.13-pre..done!"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/html": [
              "Successfully added reference to package SIPSorcery, version 4.0.13-pre"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "SIPSorcery Registration Demo\n",
            "Waiting 10s for registration to complete...\n",
            "sip:softphonesample@sipsorcery.com registration succeeded.\n",
            "Finished.\n"
          ]
        }
      ],
      "execution_count": 11,
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [],
      "outputs": [],
      "execution_count": null,
      "metadata": {}
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": ".NET (C#)",
      "language": "C#",
      "name": ".net-csharp"
    },
    "language_info": {
      "name": "C#",
      "version": "8.0",
      "mimetype": "text/x-csharp",
      "file_extension": ".cs",
      "pygments_lexer": "csharp"
    },
    "nteract": {
      "version": "0.21.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}